<template>
	<view class="reply-container">
		<view style="padding: 20rpx;">
			<view class="toast-top">
				<view class="flex">
					<text style="color: red;">*</text>
					<view class="desc">任务评分</view>
				</view>
				<van-stepper @change="handleChange" input-width="80rpx" button-size="64rpx" :value="params['评价分数']" min="1" max="100" />
				
			</view>
			<!-- <view class="title"><text style="color: red;">*</text>评价描述</view> -->
			<textarea style="height: 360rpx;" v-model="params['评价内容']" class="content" placeholder="请输入评价内容..." name="" id="" cols="30" rows="10"></textarea>
		</view>
		<button class="btn" @click="submit">提交</button>
	</view>
</template>

<script>
	import uploader from '@/myComponents/image-uploader.vue'
	export default {
		data() {
			return {
				params: {
					任务id: null,
					评价分数: 1,
					评价内容: ''
				}
			}
		},
		components: {
			uploader
		},
		onLoad(options) {
			this.params.任务id = [+options.id]
		},
		methods: {
			handleChange(event) {
				this.params.评价分数 = event.detail
			},
			onchange(e) {
				this.params.附件 = e
			},
			// onChange(e) {
			// 	console.log('rate发生改变:' + JSON.stringify(e))
			// 	console.log(this.rateValue)
			// },
			submit() {
				if (this.params.评价内容.trim() == '') {
					uni.showToast({
						title: '请输入评价内容',
						icon: 'none'
					})
				} else {
					this.evaluate()
				}
			},
			evaluate() {
				uni.showLoading({
					mask: true
				})
				this.$http.post('taskSystem/task/check', this.params).then(res => {
					console.log(res)
					if (res.code === 10000) {
						uni.redirectTo({
							url: '/ticketSystem/acceptSuccess/acceptSuccess?path=/taskSystem/index/index' + '&title=返回任务首页'
						})
						// uni.redirectTo({
						//     url: '/ticketSystem/acceptSuccess/acceptSuccess?title=' + '评价成功'
						// });
						// uni.redirectTo({
						// 	url: '../success/success?path=../ticketDetail/ticketDetail&title=查看评价内容' + '&id=' + this.params.id
						// })
						// uni.navigateTo({
						// 	url: '../success/success'
						// })
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.reply-container {

		// padding: 20rpx;
		.flex {
			display: flex;
			align-items: center;
		}

		.title {
			margin-bottom: 30rpx;
		}

		.content {
			width: 710rpx;
			padding: 20rpx;
			border: 2rpx solid #ccc;
		}

		.btn {
			width: 568rpx;
			height: 80rpx;
			line-height: 80rpx;
			margin-top: 200rpx;
			background-color: #1152FC;
			color: #fff;
		}

		.toast-top {
			display: flex;
			justify-content: space-between;
			align-items: center;
			margin-bottom: 20rpx;
			margin-top: 20rpx;
			.desc {
				margin-right: 20rpx;
				font-size: 36rpx;
			}

			.desc-text {
				color: #BCBCBC;
				font-size: 32rpx;
				margin-left: 18rpx;
			}
		}
	}
</style>
